<template>
  <div style="width: 90%; height: 90%; border: 1px; margin-left: 5%">
    <div>
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item>
          <el-input
            v-model="formInline.RoutecodedName"
            placeholder="请输入工艺路线名称/编号"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-select
            v-model="formInline.Routestate"
            clearable
            placeholder="请选择"
          >
            <el-option label="启用" value="启用"></el-option>
            <el-option label="禁用" value="禁用"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="CraftShow()">查询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-button @click="processadd()">新增</el-button>
    <el-table
      :data="tableData"
      style="width: 100%"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55"> </el-table-column>
      <el-table-column prop="id" label="序号" width="100" />
      <el-table-column prop="routename" label="工艺路线名称" width="120" />
      <el-table-column prop="routecoded" label="工艺路线编号" width="200" />
      <el-table-column prop="routestate" label="状态" width="120" />
      <el-table-column prop="routeexplain" label="工艺路线说明" width="150" />
      <el-table-column prop="routeremark" label="备注" width="120" />
      <el-table-column label="操作" width="200">
        <template #default>
          <el-button link type="primary" size="small" @click="handleClick"
            >删除</el-button
          >
          <el-button link type="primary" size="small">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageindex"
      :page-sizes="[100, 200, 300, 400]"
      :page-size="pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="count"
    >
    </el-pagination>
  </div>
</template>
  
<script>
import { CraftProcessShow } from "../../api/craftprocess";
//import { processshow } from "../../api/process";
export default {
  data() {
    return {
      options: [],
      value: "",
      tableData: [],
      formInline: {
        pageindex: 1,
        pagesize: 10,
        routecodedName: "",
        routestate: "",
      },
      count: 0,
      multipleSelection: [],
    };
  },
  created() {
    this.CraftShow();
    //this.CraftShows();
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    CraftShow() {
      CraftProcessShow(this.formInline).then((ros) => {
        console.log(ros);
        this.tableData = ros.result.items;
        this.count = ros.result.totalCount;
      });
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    processadd() {
      this.$router.push("CrafProcessAdd");
    },
    handleSizeChange(val) {
      //console.log(`每页 ${val} 条`);
      this.formInline.pagesize=val;
      this.CraftShow();
    },
    handleCurrentChange(val) {
      //console.log(`当前页: ${val}`);
      this.formInline.pageindex=val;
      this.CraftShow();
    },
    
  },
};
</script>